﻿@model MusicStore.Models.Album

@{
    ViewBag.Title = "Create";
}

@*@using(Html.BeginForm("方法名", "控制器名", 数据访问方法Get/Post))*@

@*<h2>专辑新建页面</h2>
        
    @using (Html.BeginForm("Create", "SampleHtmlHelper", FormMethod.Post))
    {
    <p>
        @Html.LabelFor(model => model.ArtistId, "歌手")
        @Html.TextBox("ArtistId")
    </p>

    <p>
        @Html.LabelFor(model => model.GenreId, "流派")
        @Html.TextBox("GenreId")
    </p>

    <p>
        @Html.LabelFor(model => model.Title, "专辑名称")
        @Html.TextBox("Title")
    </p>

    <p>
        @Html.LabelFor(model => model.Price, "价格")
        @Html.TextBox("Price")
    </p>

    <p>
        @Html.LabelFor(model => model.AlbumArtUrl, "链接")
        @Html.TextBox("AlbumArtUrl")
    </p>
    <div>
        <input type="submit" ,value="新增数据" />
    </div>
    }*@
//---------------------------------------------------------------

@using (Html.BeginForm())
{
    //防CSRF攻击：防跨站请求攻击
    @Html.AntiForgeryToken()

    <div>
        <h4>当前唱片</h4>
        <hr />

        @*简单验证：当其值为真时，进行数据验证操作*@
        @Html.ValidationSummary(true, "")
        <div>
            @*标签实现
            @Html.LabelFor(实体成员, "显示文本")*@

            @Html.LabelFor(model => model.GenreId, "流派")
            <div>
                @Html.DropDownList("GenreId")

                @*简单验证：数据验证操作
                  @Html.ValidationMessageFor(实体类成员, "警示消息")*@
                @Html.ValidationMessageFor(model => model.GenreId, "流派")
            </div>
        </div>

        <div>
            @Html.LabelFor(model => model.ArtistId, "歌手")
            <div>
                @Html.DropDownList("ArtistId")
                @Html.ValidationMessageFor(model => model.ArtistId, "歌手")
            </div>
        </div>

        <div>
            @Html.LabelFor(model => model.Title,"专辑名称")
            <div>
                @*编辑文本框
                @Html.EditorFor(实体成员)*@
                @Html.EditorFor(model => model.Title)
                @Html.ValidationMessageFor(model => model.Title, "专辑名称")
            </div>
        </div>

        <div>
            @Html.LabelFor(model => model.Price,"价格")
            <div>
                @Html.EditorFor(model => model.Price)
                @Html.ValidationMessageFor(model => model.Price, "价格")
            </div>
        </div>
    </div>

}




